package com.ruoyi.jl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.jl.domain.Notice;
import com.ruoyi.jl.mapper.NoticeMapper;
import com.ruoyi.jl.service.INoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 公告 服务层实现
 * 
 * @author wh
 * @date 2019-04-29
 */
@Slf4j
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {

    @Override
    public List<Notice> list(Notice notice){
        LambdaQueryWrapper<Notice> wrapper = new LambdaQueryWrapper<>();
        if(notice != null){
            if(StringUtils.isNotEmpty(notice.getContent())){
                wrapper.like(Notice::getContent, '%' +  notice.getContent() + '%');
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
